/*                          UX-Framework                               
 *                                                                 
 *  iZE Co.,Ltd. Copyright 2009 All rights reserved.          
 *  This file is distributed under the terms of the GNU Lesser 
 *  General Public License, described in file LICENSE.                                     
 */

package jp.ize.ux.acts;

// {{{ imports
import jp.ize.ux.UXObject;
import jp.ize.ux.UXFocusManager;
import jp.ize.ux.acts.Act;
// }}}
// {{{ typedef FocusParameter
typedef FocusParameter =
{
	// {{{ var focusManager : UXFocusManager
	/**
	 * 拡大縮小率を指定します。
	 */
	var focusManager : UXFocusManager;
	// }}}
}
// }}}
// {{{ class FocusAct extends Act
/**
 * FocusAct クラス.<br>
 * 
 * @author		iZE Co., Ltd.<br>
 * @version		$Id$<br>
 */
class FocusAct extends Act
{
	// {{{ public function new()
	/**
	 * コンストラクタ
	 */
	public function new()
	{
		super();
	}
	// }}}
	// {{{ public function next( fp:FocusParameter, ?interp:BasicStateType->FocusParameter ) : BasicStateType->Void 
	/**
	 * フォーカスを次にすすめるアクションです。
	 * 
	 */
	public function next( fp:FocusParameter, ?interp:BasicStateType->FocusParameter ) : BasicStateType->Void 
	{
		return function( state : BasicStateType ) : Void {
			var param = fp;
			if ( interp!=null ) interp(state);
			param.focusManager.next();
			if ( state.subject!=null ) {
				state.subject.notify(Act.STOP);
			}
		};
	}
	// }}}
	// {{{ public function previous( fp:FocusParameter, ?interp:BasicStateType->FocusParameter ) : BasicStateType->Void 
	/**
	 * フォーカスを次にすすめるアクションです。
	 * 
	 */
	public function previous( fp:FocusParameter, ?interp:BasicStateType->FocusParameter ) : BasicStateType->Void 
	{
		return function( state : BasicStateType ) : Void {
			var param = fp;
			if ( interp!=null ) interp(state);
			param.focusManager.previous();
			if ( state.subject!=null ) {
				state.subject.notify(Act.STOP);
			}
		};
	}
	// }}}
}
// }}}
